package com.vita.bduck.root;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.test.AndroidTestCase;
import android.util.Log;

public class CommandLineTest extends AndroidTestCase {

	public void testCopyInputDrivers() throws SecurityException, IOException {
	
		//CommandLine.copyInputDrivers(getContext());
		//CommandLine.execAsRoot("touch /system/abcd");
		String cmd = "su id"; //命令
        //Runtime对象
        Runtime runtime = Runtime.getRuntime();
        try {
        		  //执行命令，并且获得Process对象
                  Process process = runtime.exec(cmd);
                  //获得结果的输入流
                  InputStream input = process.getInputStream();
                  BufferedReader br = new BufferedReader(new InputStreamReader(input));
                  String strLine;
                  while(null != (strLine = br.readLine())){
                        Log.i("aaa", "------------"+strLine);
                  }
                 
         } catch (IOException e) {
                 e.printStackTrace();
         }
	}
}
